< previous page page_456 next page >

Page 456
agSwapBytes, agSwapWords
Declare Function agSwapBytes Lib "apigid32.dll" (ByVal src As Integer) As Integer
Declare Function agSwapWords Lib "apigid32.dll" (ByVal src As Long) As Long
In rare situations, you may need to swap the order of bytes in an integer or the integers in a long. This will typically occur when working with file formats defined originally for non-Intel processors. This function provides an easy way to accomplish this task.
Pointer and Buffer Routines
These functions can be helpful when handling certain types of string and buffer operations. The operation of these functions can be implemented using Visual Basic alone, however, these functions can be more efficient and are easier to use.
agCopyData, agCopyDataBynum
Declare Sub agCopyData Lib "apigid32.dll" (source As Any, dest As Any, ByVal _
nCount As Long)
Declare Sub agCopyDataBynum Lib "apigid32.dll" Alias "agCopyData" (ByVal _
source As Long, ByVal dest As Long, ByVal nCount As Long)
This function is provided to copy data from one object to another. Two forms of this function are provided. The first accepts any type of object. If the two objects were of the same type, you could simply use the Visual Basic LSet function; however, this function can be used for copying only the specified part of the object.
The second form accepts Long parameters. It is typically used to copy data between Visual Basic structures and string buffers or memory blocks.
The source parameter specifies the address of the start of a block of memory to copy.
The dest parameter specifies the destination address for the data.
The nCount parameter specifies the number of bytes to copy.
The RtlMoveMemory function performs the same task and is used extensively in this book. Note, however, that the order of source and destination parameters is reversed in the two functions.
Be careful that the parameters for this function are valid and that the entire range specified by nCount is also valid.

 
< previous page page_456 next page >